//
//  ACEQuestionAnswerBottomView.m
//  ACE
//
//  Created by zhangtao on 2018/8/13.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "ACEQuestionAnswerBottomView.h"

@implementation ACEQuestionAnswerBottomView{
    UIButton *leftBtn;
    UIButton *rightBtn;
}
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        leftBtn = [[UIButton alloc]initWithFrame:CGRectMake(frame.size.width/2-130, 0, 100, frame.size.height)];
        [self addSubview:leftBtn];
        [leftBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        [leftBtn setImage:[UIImage imageNamed:@"上一题"] forState:UIControlStateNormal];
        [leftBtn setTitle:@"上一题" forState:UIControlStateNormal];
        [leftBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 25, 20, 0)];
        [leftBtn setTitleEdgeInsets:UIEdgeInsetsMake(60, 0, 10, 20)];
        [leftBtn setTag:answer_left];
        [leftBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
        
        rightBtn = [[UIButton alloc]initWithFrame:CGRectMake(frame.size.width/2+50, 0, 100, frame.size.height)];
        [self addSubview:rightBtn];
        [rightBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        [rightBtn setImage:[UIImage imageNamed:@"下一题"] forState:UIControlStateNormal];
        [rightBtn setTitle:@"下一题" forState:UIControlStateNormal];
        [rightBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 24, 20, 0)];
        [rightBtn setTitleEdgeInsets:UIEdgeInsetsMake(60, 0, 10, 20)];
        [rightBtn setTag:anser_right];
        [rightBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)click:(UIButton *)btn{
    if (self.delegate && [self.delegate respondsToSelector:@selector(answerBottom:)]) {
        [self.delegate answerBottom:btn.tag];
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
